package cn.com.qtgl.apis.builtin.comp;

import cn.com.qtgl.apis.builtin.model.bean.BuiltinConfigValue;
import cn.melonlib.apis.support.annos.AppendTenant;
import cn.melonlib.apis.support.annos.IgnoreAppend;
import cn.melonlib.apis.support.model.bean.ApiModuleConfig;
import cn.melonlib.cores.aop.anno.AppendAccessToken;
import cn.melonlib.cores.aop.anno.IgnorePrepend;
import cn.melonlib.cores.aop.anno.PrependUrl;
import cn.melonlib.cores.aop.enums.AccessTokenType;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.support.ApplicationObjectSupport;
import org.springframework.stereotype.Component;

@PrependUrl
@Component
@Getter
@AppendAccessToken(type = AccessTokenType.SYSTEM)
@AppendTenant
public class SystemBuiltinConfig extends ApplicationObjectSupport implements ApiModuleConfig {

    public static final String CONFIG_NAME="systemBuiltinConfig";

    @Value("${apis.builtin}")
    private String builtin;

    public BuiltinConfigValue getValue(){
        return new BuiltinConfigValue(builtin);
    }

    @Override

    public String getUrl() {
        return builtin;
    }

    @Override
    @IgnoreAppend
    @IgnorePrepend
    public String getName() {
        return "BUILTIN";
    }

    @Override
    @IgnoreAppend
    @IgnorePrepend
    public AccessTokenType accessTokenType() {
        return AccessTokenType.SYSTEM;
    }
}
